<template>
  <a-layout style="height: calc(100vh - 64px)" class="overflow-hidden">
    <a-result :status="status" title="欢迎您使用!" :sub-title="msg">
      <template #extra>
        <!-- <a-button type="primary" @click="login">退出</a-button> -->
      </template>
    </a-result>
  </a-layout>
</template>
<script lang="ts" setup>
import { eLocalStorageConfig } from '@/interface/elocal_storage';
// import { useUserInfo } from '@/store/user';
import { getAuthRoute } from '@/utils/route.utils';
import { ResultStatusType } from 'ant-design-vue/lib/result';
import { onBeforeMount, ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
// const storeUser = useUserInfo();
const msg = ref<string>('正在获取您的页面权限，请稍等!');
const status = ref<ResultStatusType>('success');
// const login = () => {
//   storeUser.logOut();
//   setTimeout(() => {
//     router.push({ name: "login" });
//   }, 200);
// };


onBeforeMount(async () => {
  const info = sessionStorage.getItem(eLocalStorageConfig.LOG_LEVEL);
  const routes = await getAuthRoute(router);
  if (info !== 'admin') {
    if (routes.length === 0) {
      // router.push("/404")
      // msg.value = '您还没有对应的页面权限，请联系管理员给该账号配置权限。';
      msg.value = '正在获取页面权限，请稍等';
      status.value = 'error';
      router.replace({ path: '/large_screen/zfn' });
    } else {
      router.push(routes[0].path);
    }
  } else {
    // router.push('/');
    router.push(routes[0].path);
  }
});
</script>
<style lang="scss" scoped></style>
